package com.easybacklog.client.vision;

import com.easybacklog.client.cucumberfeatures.edit.ButtonCancel;
import com.easybacklog.client.cucumberfeatures.edit.ButtonSaveBacklogFeature;
import com.easybacklog.client.model.ProjectFeature;
import com.easybacklog.client.utilities.FormField;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * 
 * @UserInterface
 */
public class VisionForm extends VerticalPanel {

	public static TextArea description = new TextArea();

	public VisionForm(ProjectFeature feature) {

		this.setSpacing(10);

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		HTML html = new HTML(
				"<b><font color='blue' size='3'>Vision</font></b> ");
		this.add(html);

		VerticalPanel vp = new VerticalPanel();
		vp.setBorderWidth(1);

		vp.add(storyForm(feature));

		this.add(vp);
	}

	public VerticalPanel storyForm(ProjectFeature feature) {

		VerticalPanel vp = new VerticalPanel();
		vp.setSpacing(20);

		description.setSize("500px", "80px");
		description.setValue(feature.getFeatureDescription());
		vp.add(FormField.getFormField("", description));

		vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		vp.add(hpButtons(feature));

		return vp;
	}

	private static HorizontalPanel hpButtons(ProjectFeature feature) {

		HorizontalPanel hp = new HorizontalPanel();

		hp.setSpacing(15);

		hp.add(new ButtonSaveBacklogFeature(feature));

		hp.add(new ButtonCancel());

		return hp;
	}
}
